<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of conexion
 *
 * @author JosLap
 */
class Conexion {
    //put your code here
    public static $server = 'localhost';
    public static $username = 'root';
    public static $password = '';
    
    public static function init($server=NULL, $username=NULL, $password=NULL) {
        $server==NULL?Conexion::$server="localhost":Conexion::$server=$server;
        $username==NULL?Conexion::$username="root":Conexion::$username=$username;
        $password==NULL?Conexion::$password="":Conexion::$password=$password;
    }


    public static function conectar() {
        
        $result = mysql_connect(Conexion::$server, Conexion::$username, Conexion::$password);
        if(!$result)
            Escritor::escribir (mysql_error());
    }
    
    public static function desConectar() {
        $result = mysql_close();
        if(!$result)
            Escritor::escribir (mysql_error());
    }
    
    
    public static function selectDB($database=NULL) {
        $database==NULL?$db="las_tias":$db=$database;
        $result = mysql_select_db($db);
        if(!$result)
            Escritor::escribir (mysql_error());
    }
}

?>
